import { defineConfig } from 'vite';
import path from 'path';
import vue from '@vitejs/plugin-vue';
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';

// https://vitejs.dev/config/
export default defineConfig({
	plugins: [
		vue(),
		AutoImport({
			resolvers: [ElementPlusResolver()],
		}),
		Components({
			resolvers: [ElementPlusResolver()],
		}),
	],
	root: path.join(__dirname, './src/page'),
	publicDir: path.join(__dirname, '../../public'),
	base: './',
	resolve: {
		alias: {
			'@v': path.join(__dirname, './src/page'),
			'@p': path.join(__dirname, './src/types'),
			'@type': path.join(__dirname, './src/types'),
		},
	},
	build: {
		outDir: path.join(__dirname, 'dist/page'),
	},
	server: {
		port: 6008,
	},
});
